<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    // Number.EPSILON解决浮点数Float的精度问题
    console.log((0.1+0.2)===0.3); 

    function equal(a,b){
      if(Math.abs(a-b)<Number.EPSILON){
        return true
      }else{
        return false
      }
    }
    console.log(equal(0.1+0.2,0.3));
  </script>
</body>
</html>